package com.zhongbei.service.impl;

import com.zhongbei.mapper.ActivityMapper;
import com.zhongbei.pojo.Activity;
import com.zhongbei.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Autowired
    private ActivityMapper activityMapper;

    //依赖注入
    @Override
    public int insertActivity(Activity activity) {
        int i = activityMapper.insertActivity(activity);
        return i;
    }

    @Override
    public int deleteActivityByActivityId(Integer activityId) {
        int i = activityMapper.deleteActivityByActivityId(activityId);
        return i;
    }

    @Override
    public int updateActivityByActivityId(Activity activity) {
        int i = activityMapper.updateActivityByActivityId(activity.getActivityId(),activity );
        return i;
    }

    @Override
    public List<Activity> selectActivity() {
        List<Activity> allactivity = activityMapper.selectActivity();
        return allactivity;
    }

    @Override
    public List<Activity> selectActivityByActivityId(int activityId) {
        List<Activity> activityByActivityId = activityMapper.selectActivityByActivityId(activityId);
        return activityByActivityId;
    }

    @Override
    public List<Activity> selectActivityByBranchId(int branchId) {
        List<Activity> activityByBranchId = activityMapper.selectActivityByBranchId(branchId);
        return activityByBranchId;
    }

    @Override
    public List<Activity> selectActivityByMemberId(int memberId) {
        List<Activity> activityByMemberId = activityMapper.selectActivityByMemberId(memberId);
        return activityByMemberId;
    }

    @Override
    public List<Activity> selectActivityByMemberIdAndBranchId(int memberId, int branchId) {
        List<Activity> activityByMemberIdAndBranchId = activityMapper.selectActivityByMemberIdAndBranchId(memberId, branchId);
        return activityByMemberIdAndBranchId;
    }


}